$affydir="/data4/bsi/RandD/Workflow/temp/Easy_imputer_test/GBM/AFFY";
open(AFFY_TFAM,"$affydir/fwdStrandResults_input.tfam") or die "no file found $affydir/fwdStrandResults_input.tfam\n";
while(<AFFY_TFAM>)
{
	chomp($_);
	@a=split(" ",$_);
	@samp=split("-",$a[0]);
	$samp[3]=~ s/A|B|C|D//g;
	if($samp[3] eq "10" || $samp[3] eq "11")
	{
		$samp= "$samp[0]-$samp[1]-$samp[2]-$samp[3]";
		#print $samp."\n";
		$affy{$samp}=$_;
	}
}
$illdir="/data4/bsi/RandD/Workflow/temp/Easy_imputer_test/GBM/ILLUMINA";
open(AFFY_TFAM,"$illdir/fwdStrandResults_input.tfam") or die "no file found $illdir/fwdStrandResults_input.tfam\n";
open(WR_AF_TFAM,">/data4/bsi/RandD/Workflow/temp/Easy_imputer_test/GBM/scripts/compare_affy/sample.txt");
open(WR_ILL_TFAM,">/data4/bsi/RandD/Workflow/temp/Easy_imputer_test/GBM/scripts/compare_ill/sample.txt");
while(<AFFY_TFAM>)
{
        chomp($_);
        @a=split(" ",$_);
        @samp=split("-",$a[0]);
        $samp[3]=~ s/A|B|C|D//g;
	if($samp[3] eq "10" || $samp[3] eq "11")
	{
		$samp= "$samp[0]-$samp[1]-$samp[2]-$samp[3]";
		#die $samp."\n";
		if(exists($affy{$samp}))
		{	
			$ill{$samp}=$_;
			#print WR_ILL_TFAM $_."\n"; 
			#$aff{$samp}=$affy{$samp};
			#print WR_AF_TFAM $affy{$samp}."\n"; 
				
		}	
	}
}
while(my($key,$value)=each %affy)
{
	if($affy{$key} =~ m/\w+/ && $ill{$key} =~ m/\w+/)
	{
		print WR_AF_TFAM $affy{$key}."\n";
		print WR_ILL_TFAM $ill{$key}."\n";
	}
}
=head
undef(%affy);
open(AFFY_TPED,"gunzip -c $affydir/fwdStrandResults_input.tped.gz |") or die " no file exists $affydir/fwdStrandResults_input.tped.gz\n";
while(<AFFY_TPED>)
{
	chomp($_);
	@a=split(" ",$_);
	$affy_tped{$a[1]}=2;
	d
}
open(ILL_TPED,"gunzip -c $illdir/fwdStrandResults_input.tped.gz |") or die " no file exists $affydir/fwdStrandResults_input.tped.gz\n";
while(<ILL_TPED>)
{
	chomp($_);
	@a=split(" ",$_);
	if(exists($aff_tped{$a[1]}))
	{
		$ill_tped{$a[1]}=1;
		$aff_tped{$a[1]}=$affy_tped{$a[1]};
	}	
}	
while(($key,$value)=each %ill_tped)
{
	print $key."\t".$value."\t$aff_tped{$key}\n";
}
undef(%affy_tped);
=cut
